#include "TLBBObjectModel.h"
#include "TLBBScene.h"
#include "TLBBTerrain.h"
#include "TLBBObjectSky.h"
#include "TLBBObjectStaticEntity.h"
#include "TLBBUtils.h"
#include "TLBBObjectLight.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include "TLBBSceneLoader.h"

#include <ExampleApplication.h>
#include <ExampleFrameListener.h>
using namespace std;


class TLBBFrameListener : public ExampleFrameListener
{
private:
    
public:
    TLBBFrameListener(RenderWindow* win, Camera* cam) : ExampleFrameListener( win, cam )
    {
    }

    bool frameStarted( const FrameEvent& evt )
    {
        if( ExampleFrameListener::frameStarted( evt ) == false )
		return false;

        return true;
    }
};

class TLBBApplication : public ExampleApplication
{
public:
    TLBBApplication(char* scenefile) 
	{
		mSceneFile = scenefile;
	}
	TLBBSceneLoader* mLoader;
	Ogre::String mSceneFile;

protected:
    virtual void createFrameListener(void)
    {
        mFrameListener= new TLBBFrameListener(mWindow, mCamera);
        mRoot->addFrameListener(mFrameListener);
    }

    // Just override the mandatory create scene method
    void createScene(void)
    {
        // Set ambient light
        mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));

        mLoader = new TLBBSceneLoader(mSceneMgr);
		Ogre::String name = Ogre::String(mSceneFile);
		mLoader->Load(name);
    }

};

int main(int argc,char** argv)
{
	TLBBApplication app(argv[1]);
	app.go();

	return 0;
}